// -----------------------------------------------------------------------------
//
// Work is licensed by Arthur Fermi (C)2008-2011,
// under Creative Commons Attribution-Share Alike 3.0 Unported License
// To receive a copy of this license please visit
// http://creativecommons.org/licenses/by-sa/3.0/
//
// You are free to copy, distribute, transmit and adapt the work
// under the following conditions:
//
// You must attribute the work in the manner specified by the 
// author(s) or licensor (but not in any way that suggests that 
// they endorse you or your use of the work). 
//
// If you alter, transform, or build upon this work in any way,
// you may distribute the resulting work only under the same or 
// similar license to this one. 
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See points (6) and (7) of the license for more details.

// SimNet Update Server
// Date:  03/28/11

// -----------------------------------------------------------------------------

// Set the channel for your update server, you will need to set the channel to be the same in the update server.
integer gintComm1 = -123456;

// -----------------------------------------------------------------------------

default
{
    on_rez(integer start_param)
    {
        llResetScript();
    }

    state_entry()
    {
        llListen(gintComm1, "", "", "");
    }
    
    listen(integer channel, string name, key id, string message)
    {
        //Convert Message to a string
        list tmpList = llParseString2List(message, ["^"], [""]);
    
        if (llList2String(tmpList, 2) == "SimNet Toolbar Update")
        {
            llGiveInventory(llList2String(tmpList, 1),llGetInventoryName(INVENTORY_OBJECT, 0));
            
            llOwnerSay(llList2String(tmpList, 0) + " was given '" + llGetInventoryName(INVENTORY_OBJECT, 0) + "'.  If this wasn't the correct toolbar please check the update server and verify that there is only one toolbar/package to give out.");
        }
    }
}

